Skip to content

Conversation

@CrabJournal
Copy link

In Linux kernel since commit torvalds/linux@e2b39df property "offset" is exported, but it was just mem->addr & ~PAGE_MASK until commit torvalds/linux@171058f when addr became "rounded to page size" and offset became a field of struct uio_mem. But in uio_pdrv_genirq until commit torvalds/linux@7aca462 addr wasn't rounded by page size and field offset wasn't even initialized. Memory to struct where uio_mem is allocated by kzalloc so offset was 0.

In this commit offset calculated as addr & (getpagesize () - 1) if:

  1. file "offset" doesn't exist
  2. 0 was read from file "offset"

In Linux kernel since commit torvalds/linux@e2b39df property "offset" is exported,
but it was just `mem->addr & ~PAGE_MASK` until commit torvalds/linux@171058f when
`addr` became "rounded to page size" and `offset` became a field of `struct uio_mem`.
But in uio_pdrv_genirq until commit torvalds/linux@7aca462 `addr` wasn't rounded by
page size and field `offset` wasn't even initialized. Memory to struct where uio_mem
is allocated by kzalloc so offset was 0.

In this commit `offset` calculated as `addr & (getpagesize () - 1)` if:
1) file "offset" doesn't exist
2) 0 was read from file "offset"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant